package book_management.user;

import book_management.user.book.BookList;
import book_management.user.user.AdminUser;
import book_management.user.user.NormalUser;
import book_management.user.user.User;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //用户登录
        //1、输入用户名
        //2.根据用户名确定用户身份
        User user=login();
        BookList bookList=new BookList();
        while(true){
            int choice=user.menu();
            if(choice==-1){
                System.out.println("byebye~");
                break;
            }
            user.DoOperation(choice,bookList);
        }
    }
        public static User login(){
            Scanner scanner=new Scanner(System.in);
            System.out.println("请输入用户名:");
            String userName=scanner.next();
            System.out.println("请输入您的身份，1表示普通用户，0表示管理员");
            int choice=scanner.nextInt();
            if(choice==1){
                return new NormalUser(userName);
            }else{
                return new AdminUser(userName);
            }
    }
}


